//
//  CUtil.m
//  jumpingfrog
//
//  Created by Tri Vo on 8/29/13.
//  Copyright (c) 2013 Tri Vo. All rights reserved.
//

#import "CUtil.h"

@implementation CUtil

+ (CCSprite *)getSpriteByCharacter:(NSString *) strSymbol {
    CCSprite *pSprite = nil;
    if ([strSymbol isEqualToString:MAP_SYMBOLS_BEGIN_LEAF]) {
        pSprite = [CCSprite spriteWithSpriteFrameName:SPRITE_MAP_BEGIN_LEAF];
    } else if ([strSymbol isEqualToString:MAP_SYMBOLS_DES_LEAF]) {
        pSprite = [CCSprite spriteWithSpriteFrameName:SPRITE_MAP_DES_LEAF];
    } else if ([strSymbol isEqualToString:MAP_SYMBOLS_LEAF_FLY]) {
        pSprite = [CCSprite spriteWithSpriteFrameName:SPRITE_MAP_NORMAL_LEAF];
    } else if ([strSymbol isEqualToString:MAP_SYMBOLS_NORMAL_LEAF]) {
        pSprite = [CCSprite spriteWithSpriteFrameName:SPRITE_MAP_NORMAL_LEAF];
    } else if ([strSymbol isEqualToString:MAP_SYMBOLS_STONE]) {
        pSprite = [CCSprite spriteWithSpriteFrameName:SPRITE_MAP_STONE];
    }
    return pSprite;
}

+ (NSInteger)randomIntBetween:(NSInteger)min and:(NSInteger)max {
    return (NSInteger)(min + arc4random_uniform(max + 1 - min));
}

@end
